<?php
namespace app\alipay\controller;

class AppTestController extends SdkTestController
{
    public function pay()
    {
        $content=[
            "product_code"=>"QUICK_MSECURITY_PAY",
            "out_trade_no"=>time(),
            "total_amount"=>1.03,
            "subject"=>"app pay test",
        ];
        $request = new AlipayTradeAppPayRequest();
        $request->setNotifyUrl("商户外网可以访问的异步地址");
        $request->setBizContent(json_encode($content));
        $response = $this->client->sdkExecute($request);
        return $response;
    }
    public function notify()
    {
        $sign_type = empty($_POST["sign_type"]) ? "RSA" : $_POST["sign_type"];
        $flag = $this->client->rsaCheckV1($_POST, NULL, $sign_type);
        if($flag){
            echo "success";
        }
    }
}
